home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
misc
/
egs.lha
/
EGS
/
EGS_Devels
/
Examples
/
Other
/
curvestar.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-17
|
3KB
|
112 lines
/* curvestar.c
*
* FM - 12.08.92
*
* Renders a colour flow in the shape of a star by using B-Splines
*
*/
#include <exec/types.h>
#include <proto/exec.h>
#include <egs/egsintui.h>
#include <egs/proto/egsintui.h>
#include <egs/pragmas/egsintui.h>
#include <egs/egsgfx.h>
#include <egs/proto/egsgfx.h>
#include <egs/pragmas/egsgfx.h>
#include <egs/egs.h>
#include <egs/proto/egs.h>
#include <egs/pragmas/egs.h>
#include <egs/egsblit.h>
/* the pointers to our libraries */
struct Library *EGSIntuiBase;
struct Library *EGSGfxBase;
struct Library *EGSBase;
/* Rendering of a regular round star with four spikes */
void drawStar8( EG_RastPortPtr rp, long mx, long my, long h1, long h2 )
{
EG_AreaMove ( rp, mx, my-h1 );
EG_AreaCurve( rp, h2, h1-h2, h2-h1, -h2, mx+h1, my );
EG_AreaCurve( rp, h2-h1, h2, h2, h2-h1, mx, my+h1 );
EG_AreaCurve( rp, -h2, h2-h1, h1-h2, h2, mx-h1, my );
EG_AreaCurve( rp, h1-h2, -h2, -h2, h1-h2, mx, my-h1 );
EG_AreaEnd( rp );
}
/* something's happening here */
#define MAX_SIZE 100
void doThings( EI_WindowPtr window )
{
long size;
struct EB_ClipRect clip;
clip.Next = NULL;
clip.Left = window->BorderLeft;
clip.Top = window->BorderTop;
clip.Right = window->BorderLeft+window->Width-1;
clip.Bottom = window->BorderTop+window->Height-1;
EG_InstallClipRegion(window->RPort,&clip);
for( size=2*MAX_SIZE; size>1; size-- )
{
EG_SetAPen( window->RPort, ((255*size)/MAX_SIZE)*0x1010000 + 0x0000ff00 );
drawStar8( window->RPort, window->Width/2 + window->BorderLeft,
window->Height/2 + window->BorderTop ,
MAX_SIZE,size );
}
EG_RemoveClipRegion(window->RPort);
WaitPort( window->UserPort );
}
/* main program */
void main( int argc, char *argv[] )
{
static struct EI_NewWindow newWindow =
{
50,30, 400,300,
0,0, 0,0,
NULL,
EI_WINDOWCLOSE | EI_WINDOWBACK | EI_WINDOWDRAG,
NULL,
"Testfenster",
EI_SMART_REFRESH,
EI_iCLOSEWINDOW,
NULL,
{0,0,0,0,0,0,0},
NULL,
NULL
};
EI_WindowPtr window;
/* die Libraries öffnen */
EGSIntuiBase = OpenLibrary( (UBYTE *)"egsintui.library", 0 );
if ( EGSIntuiBase )
{
EGSGfxBase = OpenLibrary( (UBYTE *)"egsgfx.library", 0 );
if ( EGSGfxBase )
{
EGSBase = OpenLibrary( (UBYTE *)"egs.library", 0 );
if ( EGSBase )
{
window = EI_OpenWindow( &newWindow );
if ( window )
{
doThings( window );
EI_CloseWindow( window );
}
CloseLibrary( EGSBase );
}
CloseLibrary( EGSGfxBase );
}
CloseLibrary( EGSIntuiBase );
}
}